//
//  BillViewController.m
//  LineMoney
//
//  Created by 尹宁 on 16/7/12.
//  Copyright © 2016年 范琦. All rights reserved.
//

#import "BillViewController.h"
#import "BidTopView.h"
#import "MyBillTableViewCell.h"
@interface BillViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) BidTopView *topView;
@property (nonatomic, strong) UIView *bigView;
@end

@implementation BillViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"我的账单";
    [self creatBigView];
    [self creatTopView];
    [self initTableView];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBarHidden = NO;
    self.tabBarController.tabBar.hidden = YES;
}

- (void)creatBigView
{
    _bigView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KSCREENWIDTH, KSCREENHEIGHT)];
    _bigView.backgroundColor = [UIColor clearColor];
    [self.view addSubview:_bigView];
    
}
- (void)creatTopView
{
    self.topView = [[[NSBundle mainBundle] loadNibNamed:@"BidTopView" owner:self options:nil] lastObject];
    _topView.frame = CGRectMake(0, 0, KSCREENWIDTH, 32);
//    self.topView.backgroundColor = [UIColor colorWithRed:244 / 255.0 green:244 / 255.0 blue:244 / 255.0 alpha:1];
    self.topView.backgroundColor = [UIColor whiteColor];
    _topView.fistLabel.text = @"选择账户";
    _topView.secondLabel.text = @"时间段";
    [_bigView addSubview:_topView];
}

- (void)initTableView
{
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, _topView.bounds.size.height, KSCREENWIDTH, KSCREENHEIGHT - _topView.bounds.size.height ) style:UITableViewStylePlain];
    [_bigView addSubview:_tableView];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [_tableView setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];// 如果没有数据下方不显示分割线
    [_tableView registerNib:[UINib nibWithNibName:@"MyBillTableViewCell" bundle:nil] forCellReuseIdentifier:@"cell"];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    MyBillTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];// 去掉点击之后的阴影
    return cell;
    
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//    BidDetailViewController *bidDetail = [[BidDetailViewController alloc] init];
//    [self.navigationController pushViewController:bidDetail animated:YES];
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 178;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 10;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
